<?php 
if(isset($_POST["amount"]))
{
$amount=$_POST["amount"];
$from_currency=$_POST["from"];
$to_currency=$_POST["to"];


$amount = urlencode($amount);
$from_currency = urlencode($from_currency);
$to_currency = urlencode($to_currency);
$submit_url = "http://www.google.com/ig/calculator?hl=en&q=$amount$from_currency=?$to_currency";
$chr = curl_init();


curl_setopt ($chr, CURLOPT_URL, $submit_url);
curl_setopt ($chr, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($chr,  CURLOPT_USERAGENT , "Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1)");
curl_setopt ($chr, CURLOPT_CONNECTTIMEOUT, 0);
 $data = curl_exec($chr);
curl_close($chr);
$data = explode('"', $data);
$rate=$data[3];


echo $_POST["amount"]." ".$from_currency." = $rate ";
exit();
}
?>